//
//  GLViewControllerForTop.m
//  ttpod
//
//  Created by apple on 16/3/23.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "GLViewControllerForTop.h"
#import "GLTableViewHeaderForTop.h"
#import "GLTableViewCellForTop.h"

#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height

@interface GLViewControllerForTop () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, retain) UITableView *tableViewForTop;

@end

@implementation GLViewControllerForTop

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
   
}



#pragma mark - 创建tableView
- (void)createTableView {
    
    self.tableViewForTop = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT) style:UITableViewStylePlain];
    
    [self.view addSubview:self.tableViewForTop];
    
    self.tableViewForTop.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    self.tableViewForTop.delegate = self;
    
    self.tableViewForTop.dataSource = self;
    
    [self.tableViewForTop registerClass:[GLTableViewHeaderForTop class] forHeaderFooterViewReuseIdentifier:@"poolForHeadOfTop"];
    
    [self.tableViewForTop registerClass:[GLTableViewCellForTop class] forCellReuseIdentifier:@"poolForTop"];
    
}

#pragma mark - 区数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 3;
    
}

#pragma mark - 行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 10;
    
}

#pragma mark - 行重用池
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    GLTableViewCellForTop *cell = [tableView dequeueReusableCellWithIdentifier:@"poolForTop"];
    
    return cell;
    
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    
    GLTableViewHeaderForTop *Header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"poolForHeadOfTop"];
    
    return Header;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
